
// 确认加点方案 {"魔力":0,"耐力":0,"敏捷":0,"力量":6,"体质":0}
export const desc = {
    "name": "确认加点方案",
    "desc": "确认加点方案",
    "params_type": "json",
    "params": [
        {
            "en_name": "魔力",
            "cn_name": "魔力",
            "desc": "",
            "example": 1
        },
        {
            "en_name": "耐力",
            "cn_name": "耐力",
            "desc": "",
            "example": 1
        },
        {
            "en_name": "敏捷",
            "cn_name": "敏捷",
            "desc": "",
            "example": 1
        },
        {
            "en_name": "力量",
            "cn_name": "力量",
            "desc": "",
            "example": 1
        },
        {
            "en_name": "体质",
            "cn_name": "体质",
            "desc": "",
            "example": 1
        },
    ],
    "returns": [],
    "example": 'JGESDK:发送(8,{"魔力":0,"耐力":0,"敏捷":0,"力量":6,"体质":0})'
}
// @ts-ignore
export async function execute(client_id, message_json) {
    let login_characters = G.Characters.get_current_login_characters(client_id);

    let sum = message_json["魔力"] + message_json["耐力"] + message_json["敏捷"] + message_json["力量"] + message_json["体质"];

    if (sum <= 0) {
        //什么都不做
        ClientUtils.send_basic_prompt(client_id, "#Y没有提交任何加点信息");
        return;
    }
    if (login_characters["潜力"] < 1) {
        ClientUtils.send_basic_prompt(client_id, "#Y潜力值不足");
        return;
    }
    if (sum > login_characters["潜力"]) {
        ClientUtils.send_basic_prompt(client_id, "#Y潜力值不足");
        return;
    }

    login_characters["潜力"] = login_characters["潜力"] - sum;

    //更新加点方案
    login_characters["加点方案"][0]["潜力"] = login_characters["潜力"];
    login_characters["加点方案"][0]["体质"] += message_json["体质"];
    login_characters["加点方案"][0]["魔力"] += message_json["魔力"];
    login_characters["加点方案"][0]["力量"] += message_json["力量"];
    login_characters["加点方案"][0]["耐力"] += message_json["耐力"];
    login_characters["加点方案"][0]["敏捷"] += message_json["敏捷"];

    //更新属性
    login_characters["体质"] += message_json["体质"];
    login_characters["魔力"] += message_json["魔力"];
    login_characters["力量"] += message_json["力量"];
    login_characters["耐力"] += message_json["耐力"];
    login_characters["敏捷"] += message_json["敏捷"];

    //通知客户端更新面板
    G.Characters.refrush_characters_ui_data(login_characters);

}